package week06.personcmp;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Random;

public class TestPersonCmp {


    public static void main(String[] args) {
        Person[] personArray=new Person[10];
        Random rdn=new Random();
        for(int i=0;i<personArray.length;i++) {
            personArray[i] = new Person( rdn.nextInt(200));
        }
            for(int i=0;i<personArray.length;i++){
                System.out.print(personArray[i].getName()+":"+personArray[i].getHeight()+":"+personArray[i].getWeight());
                Arrays.sort(personArray, new Comparator<Person>() {
                    @Override
                    public int compare(Person o1, Person o2) {
                        return o1.getHeight()-o2.getHeight();
                    }
                });
            }
        }
    }

